#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int sum = 0;
int digitsum(int a)
{
	int b = 0;

	if (a > 0)
	{
		b = a % 10;
		digitsum(a / 10);
		 sum += b;
	}
	return sum;
}

int main()
{
	int a = 0;
	scanf("%d", &a);
	printf("%d",digitsum(a));
}